package edu.xhu.utils.validator;

import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;

/**
 * 手机校验类
 */
public class PhoneValidator {

    private static final String phonePattern = "^1[3-9]\\d{9}$";
    private static final Pattern pattern = Pattern.compile(phonePattern);

    public static boolean validate(String phone) {
        return pattern.matcher(phone).matches();
    }

    public static String maskPhoneNumber(String phone) {
        return phone.substring(0, 3) + "xxxxx" + phone.substring(8);
    }

    public static void main(String[] args) {
        System.out.println(validate("16272711782"));
        System.out.println(validate("029-2512-3326"));
    }
}
